xen/arm: alternative: Make it possible to patch outside of the hypervisor
authorJulien Grall <julien.grall@arm.com>
Fri, 9 Sep 2016 08:40:08 +0000 (09:40 +0100)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 9 Sep 2016 15:48:18 +0000 (11:48 -0400)
commitc085c4eac852b536a2d37188b0e14b715de20621
tree4b27e74e1bf7e944b152cd2be5d3072bd6824643
parent24e1dea03aa23adc1b700ddc9a0fbc20ccf45ffa
xen/arm: alternative: Make it possible to patch outside of the hypervisor

With livepatch the alternatives that should be patched are outside of
the Xen hypervisor _start -> _end. The current code is assuming that
only Xen could be patched and therefore will explode when a payload
contains alternatives.

Given that alt_instr contains a relative offset, the function
__apply_alternatives could directly take in parameter the virtual
address of the alt_instr set of the re-mapped region. So we can mandate
the callers of __apply_alternatives to provide use with a region that has
read-write access.

The only caller that will patch directly the Xen binary is the function
__apply_alternatives_multi_stop. The other caller apply_alternatives
will work on the payload which will still have read-write access at that
time.

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Julien Grall <julien.grall@arm.com>
xen/arch/arm/alternative.c